Skip to content

Conversation

@AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Oct 27, 2025

Customer Impact

  • Customer reported
  • Found internally

These issues were reported in #119706 as problems with clang-21 on Fedora 43. The investigation uncovered that clang introduced a potentially breaking change in clang-20 that we do not currently consume. These build changes impact VMR related builds when linux distrobutions performing source build adopt clang-21.

clang-20 breaking change log - https://releases.llvm.org/20.1.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes.

This PR contains the minimal changes needed to fix issues from the following PRs #120644 and #120775.

Regression

  • Yes
  • No

Moving to the new clang-21 compiler will cause the runtime to crash. This is a regression from using .NET 10 and the default compiler of clang-19.

Testing

This has been validated using various legs and examples to demonstrate the usage of undefined behavior these flags convert into "defined" behavior in C/C++.

Risk

Low. This makes clang-21 more permissive and is limited to non official product builds.

@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 10.0.0 milestone Oct 27, 2025
@AaronRobinsonMSFT AaronRobinsonMSFT added NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) area-Infrastructure-coreclr labels Oct 27, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas changed the title Apply changes to net 10 for building with clang-21 [release/10.0] Apply changes for building with clang-21 Oct 27, 2025
@AaronRobinsonMSFT AaronRobinsonMSFT added Servicing-consider Issue for next servicing release review and removed NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) labels Oct 27, 2025
@AaronRobinsonMSFT AaronRobinsonMSFT marked this pull request as ready for review October 27, 2025 20:56
Copilot AI review requested due to automatic review settings October 27, 2025 20:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses build failures when using clang-21 on Fedora 43 by adapting to a breaking change introduced in clang-20. The clang-20 compiler split the -fwrapv flag into separate -fwrapv and -fwrapv-pointer flags, and this PR migrates to using -fno-strict-overflow which implies both behaviors.

Key Changes:

  • Replaced -fwrapv with -fno-strict-overflow to handle signed arithmetic overflow behavior in a way compatible with clang-20+
  • Fixed type casting issues in CoreCLR debug interface code to avoid enum-to-int implicit conversion errors
  • Added -fno-strict-aliasing flag to match MSVC behavior

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/mono/CMakeLists.txt Replaced -fwrapv with -fno-strict-overflow and updated comments to explain the clang-20+ behavior
src/coreclr/debug/di/rsthread.cpp Added explicit cast from m_userState to CorDebugUserState enum and changed local variable type to int
src/coreclr/debug/di/rspriv.h Changed m_userState member variable type from CorDebugUserState to int and updated kInvalidUserState constant accordingly
eng/native/configurecompiler.cmake Replaced -fwrapv with -fno-strict-overflow and added -fno-strict-aliasing flag with updated comments

@agocke agocke added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants